package org.hadoop.rpc.server;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.hadoop.rpc.service.HelloImpl;
import org.hadoop.rpc.service.IHello;
public class RpcServer {
    public static void main(String[] args) throws Exception {
        System.setProperty("hadoop.home.dir","D:/program/hadoop-3.2.2");
        RPC.Server server = new RPC.Builder(new Configuration())
                .setProtocol(IHello.class)//设置协议即接口
                .setInstance(new HelloImpl())//设置实例类
                .setBindAddress("127.0.0.1")//设置服务器地址
                .setPort(5678)//设置服务端口
                .build();
        server.start();//启动rpc服务
    }
}
